package ext.tianma.model;

@SuppressWarnings({"cast", "deprecation", "unchecked"})
public abstract class _TMObjectModelMasterKey extends wt.fc.SemanticKey implements wt.org.OrganizationOwnedIdentificationObjectNamespace, wt.inf.container.WTContainerNamespace, java.io.Externalizable {
   static final long serialVersionUID = 1;

   static final java.lang.String RESOURCE = "ext.tianma.model.modelResource";
   static final java.lang.String CLASSNAME = TMObjectModelMasterKey.class.getName();

   wt.org.WTPrincipalReference organizationReference;
   /**
    * <b>Supported API: </b>true
    *
    * @see wt.org.OrganizationOwnedIdentificationObjectNamespace
    */
   public wt.org.WTPrincipalReference getOrganizationReference() {
      return organizationReference;
   }
   /**
    * <b>Supported API: </b>true
    *
    * @see wt.org.OrganizationOwnedIdentificationObjectNamespace
    */
   public void setOrganizationReference(wt.org.WTPrincipalReference organizationReference) throws wt.util.WTPropertyVetoException {
      organizationReferenceValidate(organizationReference);
      this.organizationReference = organizationReference;
   }
   void organizationReferenceValidate(wt.org.WTPrincipalReference organizationReference) throws wt.util.WTPropertyVetoException {
      if (!wt.fc.IdentityHelper.isChangeable(this))
         throw new wt.util.WTPropertyVetoException("wt.fc.fcResource", wt.fc.fcResource.CHANGE_RESTRICTION,
               new java.lang.Object[] { new wt.introspection.PropertyDisplayName(CLASSNAME, "organizationReference") },
               new java.beans.PropertyChangeEvent(this, "organizationReference", this.organizationReference, organizationReference));
      if (organizationReference == null)
         throw new wt.util.WTPropertyVetoException("wt.fc.fcResource", wt.fc.fcResource.REQUIRED_ATTRIBUTE,
               new java.lang.Object[] { new wt.introspection.PropertyDisplayName(CLASSNAME, "organizationReference") },
               new java.beans.PropertyChangeEvent(this, "organizationReference", this.organizationReference, organizationReference));
   }

   wt.inf.container.WTContainedIdentified containedIdentified;
   /**
    * A callback to the <code>WTContainedIdentified</code> object that this is a namespace for. This property is used internally and never needs to be set by callers.
    *
    * @see wt.inf.container.WTContainerNamespace
    */
   public wt.inf.container.WTContainedIdentified getContainedIdentified() {
      return containedIdentified;
   }
   /**
    * A callback to the <code>WTContainedIdentified</code> object that this is a namespace for. This property is used internally and never needs to be set by callers.
    *
    * @see wt.inf.container.WTContainerNamespace
    */
   public void setContainedIdentified(wt.inf.container.WTContainedIdentified containedIdentified) throws wt.util.WTPropertyVetoException {
      containedIdentifiedValidate(containedIdentified);
      this.containedIdentified = containedIdentified;
   }
   void containedIdentifiedValidate(wt.inf.container.WTContainedIdentified containedIdentified) throws wt.util.WTPropertyVetoException {
   }

   wt.inf.container.WTContainerRef containerReference;
   /**
    * The container that the <code>WTContainedIdentified</code> object is contained by. Setting this property and then calling <code>IdentityService.changeIdentity</code> will update the object's container reference.
    *
    * @see wt.inf.container.WTContainerNamespace
    */
   public wt.inf.container.WTContainerRef getContainerReference() {
      return containerReference;
   }
   /**
    * The container that the <code>WTContainedIdentified</code> object is contained by. Setting this property and then calling <code>IdentityService.changeIdentity</code> will update the object's container reference.
    *
    * @see wt.inf.container.WTContainerNamespace
    */
   public void setContainerReference(wt.inf.container.WTContainerRef containerReference) throws wt.util.WTPropertyVetoException {
      containerReferenceValidate(containerReference);
      this.containerReference = containerReference;
   }
   void containerReferenceValidate(wt.inf.container.WTContainerRef containerReference) throws wt.util.WTPropertyVetoException {
   }

   wt.inf.container.WTContainerRef namespaceReference;
   /**
    * <i>This property is used internally by the container service's identity processing. Callers should never need to set it.</i> <p> A reference to the <code>WTContainer</code> that serves as a namespace for the <code>WTContainedIdentified</code> object. This value is typically derivable from <code>WTContainerHelper.service.getNamespace</code>, except for situations where a container and its children are being re-namespaced as part of a single transaction.
    *
    * @see wt.inf.container.WTContainerNamespace
    */
   public wt.inf.container.WTContainerRef getNamespaceReference() {
      return namespaceReference;
   }
   /**
    * <i>This property is used internally by the container service's identity processing. Callers should never need to set it.</i> <p> A reference to the <code>WTContainer</code> that serves as a namespace for the <code>WTContainedIdentified</code> object. This value is typically derivable from <code>WTContainerHelper.service.getNamespace</code>, except for situations where a container and its children are being re-namespaced as part of a single transaction.
    *
    * @see wt.inf.container.WTContainerNamespace
    */
   public void setNamespaceReference(wt.inf.container.WTContainerRef namespaceReference) throws wt.util.WTPropertyVetoException {
      namespaceReferenceValidate(namespaceReference);
      this.namespaceReference = namespaceReference;
   }
   void namespaceReferenceValidate(wt.inf.container.WTContainerRef namespaceReference) throws wt.util.WTPropertyVetoException {
   }

   public java.lang.String getConceptualClassname() {
      return CLASSNAME;
   }

   public wt.introspection.ClassInfo getClassInfo() throws wt.introspection.WTIntrospectionException {
      return wt.introspection.WTIntrospector.getClassInfo(getConceptualClassname());
   }

   public java.lang.String getType() {
      try { return getClassInfo().getDisplayName(); }
      catch (wt.introspection.WTIntrospectionException wte) { return wt.util.WTStringUtilities.tail(getConceptualClassname(), '.'); }
   }

   public static final long EXTERNALIZATION_VERSION_UID = -4236362769123525171L;

   public void writeExternal(java.io.ObjectOutput output) throws java.io.IOException {
      output.writeLong( EXTERNALIZATION_VERSION_UID );

      super.writeExternal( output );

      output.writeObject( namespaceReference );
      output.writeObject( organizationReference );

      if (!(output instanceof wt.pds.PDSObjectOutput)) {
         output.writeObject( containedIdentified );
         output.writeObject( containerReference );
      }

   }

   protected void super_writeExternal_TMObjectModelMasterKey(java.io.ObjectOutput output) throws java.io.IOException {
      super.writeExternal(output);
   }

   public void readExternal(java.io.ObjectInput input) throws java.io.IOException, java.lang.ClassNotFoundException {
      long readSerialVersionUID = input.readLong();
      readVersion( (ext.tianma.model.TMObjectModelMasterKey) this, input, readSerialVersionUID, false, false );
   }
   protected void super_readExternal_TMObjectModelMasterKey(java.io.ObjectInput input) throws java.io.IOException, java.lang.ClassNotFoundException {
      super.readExternal(input);
   }

   public void writeExternal(wt.pds.PersistentStoreIfc output) throws java.sql.SQLException, wt.pom.DatastoreException {
      super.writeExternal( output );

      output.writeObject( "namespaceReference", namespaceReference, wt.inf.container.WTContainerRef.class, false );
      output.writeObject( "organizationReference", organizationReference, wt.org.WTPrincipalReference.class, true );
   }

   public void readExternal(wt.pds.PersistentRetrieveIfc input) throws java.sql.SQLException, wt.pom.DatastoreException {
      super.readExternal( input );

      namespaceReference = (wt.inf.container.WTContainerRef) input.readObject( "namespaceReference", namespaceReference, wt.inf.container.WTContainerRef.class, false );
      organizationReference = (wt.org.WTPrincipalReference) input.readObject( "organizationReference", organizationReference, wt.org.WTPrincipalReference.class, true );
   }

   boolean readVersion_4236362769123525171L( java.io.ObjectInput input, long readSerialVersionUID, boolean superDone ) throws java.io.IOException, java.lang.ClassNotFoundException {
      if ( !superDone )
         super.readExternal( input );

      namespaceReference = (wt.inf.container.WTContainerRef) input.readObject();
      organizationReference = (wt.org.WTPrincipalReference) input.readObject();

      if (!(input instanceof wt.pds.PDSObjectInput)) {
            containedIdentified = (wt.inf.container.WTContainedIdentified) input.readObject();
            containerReference = (wt.inf.container.WTContainerRef) input.readObject();
      }

      return true;
   }

   protected boolean readVersion( TMObjectModelMasterKey thisObject, java.io.ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone ) throws java.io.IOException, java.lang.ClassNotFoundException {
      boolean success = true;

      if ( readSerialVersionUID == EXTERNALIZATION_VERSION_UID )
         return readVersion_4236362769123525171L( input, readSerialVersionUID, superDone );
      else
         success = readOldVersion( input, readSerialVersionUID, passThrough, superDone );

      if (input instanceof wt.pds.PDSObjectInput)
         wt.fc.EvolvableHelper.requestRewriteOfEvolvedBlobbedObject();

      return success;
   }
   protected boolean super_readVersion_TMObjectModelMasterKey( _TMObjectModelMasterKey thisObject, java.io.ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone ) throws java.io.IOException, java.lang.ClassNotFoundException {
      return super.readVersion(thisObject, input, readSerialVersionUID, passThrough, superDone);
   }

   boolean readOldVersion( java.io.ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone ) throws java.io.IOException, java.lang.ClassNotFoundException {
      throw new java.io.InvalidClassException(CLASSNAME, "Local class not compatible: stream classdesc externalizationVersionUID="+readSerialVersionUID+" local class externalizationVersionUID="+EXTERNALIZATION_VERSION_UID);
   }
}
